﻿using System;

namespace Ndns.Packet.ResourceRecords
{
    public sealed class DnsResourceRecordANY : DnsResourceRecord
    {
        private byte[] _data;

        public override DnsRecordType Type { get => DnsRecordType.ANY; set => throw new NotSupportedException(); }

        public DnsResourceRecordANY() : base()
        {
            _data = Array.Empty<byte>();
        }

        public DnsResourceRecordANY(DnsHostName hostName, DnsClass c, uint ttl)
            : base(hostName, c, ttl)
        {
            _data = Array.Empty<byte>();
        }
        public DnsResourceRecordANY(DnsHostName hostName, DnsClass c, uint ttl, byte[] data)
            : base(hostName, c, ttl)
        {
            _data = data ?? throw new ArgumentNullException(nameof(data));
        }

        public override DnsResourceRecord Clone()
        {
            return new DnsResourceRecordANY(HostName, Class, TTL, _data);
        }

        public override byte[] GetData()
        {
            return _data;
        }
        public void SetData(byte[] data)
        {
            _data = data ?? throw new ArgumentNullException(nameof(data));
        }
    }
}
